package br.org.etec.dotcao.ws;

import java.util.List;

import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import br.org.etec.dotcao.model.Race;
import br.org.etec.dotcao.model.RaceRepository;
import br.org.etec.dotcao.model.RepositoryFactory;

@Path("/race")
public class RaceResource {

	@GET
	@Path("/list")
	@Produces({MediaType.APPLICATION_JSON})
	public List<Race> list(){
		return ((RaceRepository)RepositoryFactory.get(Race.class)).all();
	}

	@GET
	@Path("/list/{specie}")
	@Produces({MediaType.APPLICATION_JSON})
	public List<Race> returnRace(@PathParam("specie") long specie){
		return ((RaceRepository)RepositoryFactory.get(Race.class)).all(specie);
	}
	
}
